<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://mamsy.ru/" />
<title>if5-work-on-mamsy</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">if5-work-on-mamsy</td></tr>
</thead><tbody>
<tr>
	<td>open</td>
	<td>/</td>
	<td></td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>10</td>
	<td></td>
</tr>
<tr>
	<td>store</td>
	<td>Профсоюзная</td>
	<td>street</td>
</tr>
<tr>
	<td>store</td>
	<td>5 корп. 2</td>
	<td>home</td>
</tr>
<tr>
	<td>store</td>
	<td>133 кв. Звонок не работает</td>
	<td>flat</td>
</tr>
<tr>
	<td>store</td>
	<td>347630</td>
	<td>index</td>
</tr>
<tr>
	<td>store</td>
	<td>Александр</td>
	<td>firstname</td>
</tr>
<tr>
	<td>store</td>
	<td>Плюшкин</td>
	<td>lastname</td>
</tr>
<tr>
	<td>store</td>
	<td>347630</td>
	<td>telephone</td>
</tr>
<tr>
	<td>store</td>
	<td>0</td>
	<td>recalculation_counter</td>
</tr>
<tr>
	<td>store</td>
	<td>6</td>
	<td>maxGoodsInOrder</td>
</tr>
<tr>
	<td>store</td>
	<td>null</td>
	<td>discount_sum</td>
</tr>
<tr>
	<td>store</td>
	<td>null</td>
	<td>availableForCahrgeBonuses</td>
</tr>
<tr>
	<td>store</td>
	<td>null</td>
	<td>basket_sum_p_service_delivery_sum_minus_discount_sum: </td>
</tr>
<tr>
	<td>store</td>
	<td>null</td>
	<td>discount_sum</td>
</tr>
<!--Выбор товара-->
<tr>
	<td>storeEval</td>
	<td>4</td>
	<td>goods_counter</td>
</tr>
<!--Выбор рандомного города-->
<tr>
	<td>storeEval</td>
	<td>['Москва', 'Архангельское (Москва и МО)', 'Сертолово','Сланцы','Смоленск', 'Белые Берега', 'Большое Полпино', 'Дятьково',&nbsp;&nbsp;'Большое Село', 'Искра Октября', 'Рыбинск', 'Радужный','Пено','Тарногский Городок','Тихвин','Кенисберг','Цуриб','Озерск (Челябинская обл.)','Ленинское (Кировская обл.)','Заполярный (Мурманская обл.)','Жирятино']</td>
	<td>city_array</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>storedVars['city_array'].length</td>
	<td>city_array_length</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>Math.floor(Math.random() * (${city_array_length}))</td>
	<td>random_city_index</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>storedVars['city_array'][storedVars['random_city_index']]</td>
	<td>random_city</td>
</tr>
<tr>
	<td>echo</td>
	<td>${random_city}</td>
	<td></td>
</tr>
<tr>
	<td>store</td>
	<td>1</td>
	<td>goods_buy_count</td>
</tr>
<tr>
	<td>storeXpathCount</td>
	<td>//div[@id='content']/div[3]/a</td>
	<td>stock_count</td>
</tr>
<tr>
	<td>label</td>
	<td>startscript</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>logo</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=content</td>
	<td></td>
</tr>
<tr>
	<td>waitForVisible</td>
	<td>id=content</td>
	<td></td>
</tr>
<tr>
	<td>waitForPageToLoad</td>
	<td></td>
	<td></td>
</tr>
<!--Выбор рандомной распродажи и товара-->
<tr>
	<td>storeEval</td>
	<td>Math.floor(Math.random() * (${stock_count})+1)</td>
	<td>stock_random</td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>50</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=all-sale__box${stock_random}</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>id=all-sale__box${stock_random}</td>
	<td></td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>10</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>//div[@id='product_listing']/div/p/a/img</td>
	<td></td>
</tr>
<tr>
	<td>storeXpathCount</td>
	<td>//*[@id='product_listing']/div</td>
	<td>goods_count</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>Math.floor(Math.random() * (${goods_count})+1)</td>
	<td>goods_random</td>
</tr>
<!--ВЫБОР ТОВАРА-->
<tr>
	<td>clickAndWait</td>
	<td>//div[@id='product_listing']/div[${goods_random}]/p/a/img</td>
	<td></td>
</tr>
<!--Выбираем рандомный цвет и размер-->
<!--Выбор Цвета если есть размер-->
<tr>
	<td>storeEval</td>
	<td>if (selenium.isElementPresent(&quot;name=temp_attr_id_color&quot;)==true){nextStap=&quot;true_color_size&quot;} else {nextStap=&quot;goods_size&quot;}</td>
	<td>nextStap</td>
</tr>
<tr>
	<td>echo</td>
	<td>${nextStap}</td>
	<td></td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>${nextStap}</td>
	<td></td>
</tr>
<tr>
	<td>label</td>
	<td>true_color_size</td>
	<td></td>
</tr>
<tr>
	<td>storeXpathCount</td>
	<td>//*[@id='pinfo']/div[1]/div[2]/div[2]/ul/li</td>
	<td>color_goods_counter</td>
</tr>
<tr>
	<td>echo</td>
	<td>${color_goods_counter}</td>
	<td></td>
</tr>
<tr>
	<td>gotoIf</td>
	<td>${color_goods_counter} == 0</td>
	<td>false_goods_size_next_stap_color_without_size</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>Math.floor(Math.random()*(${color_goods_counter})+1)</td>
	<td>random_color</td>
</tr>
<tr>
	<td>click</td>
	<td>//div[@id='pinfo']/div/div[2]/div[2]/ul/li[${random_color}]</td>
	<td></td>
</tr>
<!--Выбор Размера-->
<tr>
	<td>label</td>
	<td>goods_size</td>
	<td></td>
</tr>
<tr>
	<td>storeEval</td>
	<td>if (selenium.isElementPresent(&quot;//div[@id='pinfo']/div/div[2]/div/ul/li&quot;)==true){nextStap=&quot;true_goods_size&quot;} else {nextStap=&quot;false_goods_size_next_stap_color_without_size&quot;}</td>
	<td>nextStap</td>
</tr>
<tr>
	<td>echo</td>
	<td>${nextStap}</td>
	<td></td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>${nextStap}</td>
	<td></td>
</tr>
<tr>
	<td>label</td>
	<td>true_goods_size</td>
	<td></td>
</tr>
<tr>
	<td>storeXpathCount</td>
	<td>//*[@id='pinfo']/div[1]/div[2]/div[1]/ul/li/label</td>
	<td>size_goods_counter</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>Math.floor(Math.random()*(${size_goods_counter})+1)</td>
	<td>random_size</td>
</tr>
<tr>
	<td>gotoIf</td>
	<td>${size_goods_counter} == 0</td>
	<td>find_buy_button</td>
</tr>
<tr>
	<td>click</td>
	<td>//div[@id='pinfo']/div/div[2]/div/ul/li[${random_size}]/label/input</td>
	<td></td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>find_buy_button</td>
	<td></td>
</tr>
<!--Выбор Цвета если нет разм-->
<tr>
	<td>label</td>
	<td>false_goods_size_next_stap_color_without_size</td>
	<td></td>
</tr>
<tr>
	<td>storeXpathCount</td>
	<td>//*[@id='pinfo']/div[1]/div[2]/div/ul/li/label/img</td>
	<td>color_goods_counter</td>
</tr>
<tr>
	<td>gotoIf</td>
	<td>${color_goods_counter} == 0</td>
	<td>find_buy_button</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>Math.floor(Math.random()*(${color_goods_counter})+1)</td>
	<td>random_color</td>
</tr>
<tr>
	<td>click</td>
	<td>//*[@id='pinfo']/div[1]/div[2]/div/ul/li[${random_color}]/label/img</td>
	<td></td>
</tr>
<!--Кнопка Купить есть?-->
<tr>
	<td>label</td>
	<td>find_buy_button</td>
	<td></td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>10</td>
	<td></td>
</tr>
<tr>
	<td>storeEval</td>
	<td>if (selenium.isElementPresent(&quot;id=img_submit&quot;)==true &amp;&amp; selenium.isVisible(&quot;id=img_submit&quot;)==true){nextMove=&quot;buy&quot;} else {nextMove=&quot;startscript&quot;}</td>
	<td>openPage</td>
</tr>
<tr>
	<td>echo</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<tr>
	<td>label</td>
	<td>buy</td>
	<td></td>
</tr>
<!--Кнопку можно нажать ?-->
<tr>
	<td>storeEditable</td>
	<td>id=img_submit</td>
	<td>buyButtonCanBeClicked</td>
</tr>
<tr>
	<td>gotoIf</td>
	<td>${buyButtonCanBeClicked} == false</td>
	<td>startscript</td>
</tr>
<tr>
	<td>assertElementPresent</td>
	<td>css=div.mousetrap</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>id=img_submit</td>
	<td></td>
</tr>
<!--//-->
<!---->
<!--Кол-во купленного товара-->
<tr>
	<td>while</td>
	<td>${goods_buy_count} &lt; ${goods_counter}</td>
	<td></td>
</tr>
<tr>
	<td>storeEval</td>
	<td>${goods_buy_count}+1</td>
	<td>goods_buy_count</td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>startscript</td>
	<td></td>
</tr>
<tr>
	<td>endWhile</td>
	<td></td>
	<td></td>
</tr>
<!--Кнопка купить, в корзине-->
<tr>
	<td>waitForElementPresent</td>
	<td>css=a.default_button</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>css=a.default_button</td>
	<td></td>
</tr>
<!---->
<!--CHECKOUT-->
<!--CHECKOUT-->
<tr>
	<td>clickAndWait</td>
	<td>css=a.default_button</td>
	<td></td>
</tr>
<!---->
<!---->
<!--Заполняем поля-->
<tr>
	<td>waitForElementPresent</td>
	<td>css=i.payment-box__i-cash</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=comments</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>css=input.default_button</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=customers_firstname</td>
	<td>${firstname}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=customers_lastname</td>
	<td>${lastname}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=customers_telephone</td>
	<td>${telephone}</td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>50</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_city</td>
	<td></td>
</tr>
<!--//-->
<!--//-->
<tr>
	<td>typeKeys</td>
	<td>id=entry_city</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_city</td>
	<td>1</td>
</tr>
<tr>
	<td>typeKeys</td>
	<td>id=entry_city</td>
	<td>1</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>css=input.default_button</td>
	<td></td>
</tr>
<tr>
	<td>waitForVisible</td>
	<td>css=input.default_button</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>css=input.default_button</td>
	<td></td>
</tr>
<!--//-->
<!--//-->
<tr>
	<td>type</td>
	<td>id=entry_city</td>
	<td></td>
</tr>
<tr>
	<td>typeKeys</td>
	<td>id=entry_city</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_city</td>
	<td>${random_city}</td>
</tr>
<tr>
	<td>typeKeys</td>
	<td>id=entry_city</td>
	<td>${random_city}</td>
</tr>
<!--//-->
<!--//-->
<tr>
	<td>waitForElementPresent</td>
	<td>css=i.payment-box__i-cash</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>//*[@id='content']/form/div[2]/table[2]/tbody/tr/td[2]/span/label</td>
	<td></td>
</tr>
<tr>
	<td>waitForPageToLoad</td>
	<td></td>
	<td></td>
</tr>
<!---->
<!--DELIVERY TYPE-->
<!---->
<!--Определение типа доставки:-->
<!--Два варианта - и почта и курьер-->
<tr>
	<td>storeEval</td>
	<td>if (selenium.isVisible(&quot;id=courier&quot;)==true &amp;&amp; selenium.isVisible(&quot;id=post&quot;)==true) {nextMove=&quot;random_delivery_choice&quot;} else {nextMove=&quot;only_one_type_of_delivery&quot;}</td>
	<td>openPage</td>
</tr>
<tr>
	<td>echo</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<tr>
	<td>label</td>
	<td>random_delivery_choice</td>
	<td></td>
</tr>
<tr>
	<td>storeEval</td>
	<td>Math.floor(Math.random()*(2))</td>
	<td>trigger</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>if (storedVars['trigger'] == 1 ) {nextMove=&quot;courier_delivery&quot;} else {nextMove=&quot;post_delivery&quot;}</td>
	<td>openPage</td>
</tr>
<tr>
	<td>echo</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<!--Один вариант доставки-->
<tr>
	<td>label</td>
	<td>only_one_type_of_delivery</td>
	<td></td>
</tr>
<tr>
	<td>storeEval</td>
	<td>if (selenium.isVisible(&quot;id=courier&quot;)==true){nextMove=&quot;courier_delivery&quot;} else {nextMove=&quot;post_delivery&quot;}</td>
	<td>openPage</td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<tr>
	<td>echo</td>
	<td>${openPage}</td>
	<td></td>
</tr>
<tr>
	<td>label</td>
	<td>post_delivery</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=post</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=post</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=post</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=post</td>
	<td>Почтой</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=entry_postcode</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=entry_exact_street_address</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=entry_home_address</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=entry_flat_address</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_exact_street_address</td>
	<td>${street}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_home_address</td>
	<td>${home}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_flat_address</td>
	<td>${flat}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_postcode</td>
	<td>${index}</td>
</tr>
<tr>
	<td>gotolabel</td>
	<td>end_of_delivery_choice</td>
	<td></td>
</tr>
<tr>
	<td>label</td>
	<td>courier_delivery</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=courier</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=courier</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=courier</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=courier</td>
	<td>Почтой</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=entry_exact_street_address</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=entry_home_address</td>
	<td></td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=entry_flat_address</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_exact_street_address</td>
	<td>${street}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_home_address</td>
	<td>${home}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=entry_flat_address</td>
	<td>${flat}</td>
</tr>
<tr>
	<td>label</td>
	<td>end_of_delivery_choice</td>
	<td></td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>50</td>
	<td></td>
</tr>
<!---->
